<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" placeholder="请输入猜的数字" id="i1">
    <input type="button" value="猜一猜" id="i2">
    <div>{{msg}}</div>
</div>
</body>
<!--引入jq框架-->
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<!--引入vue-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    let x=parseInt(Math.random()*100)+1;
    let a=$("#i1");
    let z=0;
    alert(x);
    let vm=new Vue({
        el:"div",
        data:{msg:""}
    })
    $("#i2").click(function () {
         z++;
        if($("input:eq(0)").val()==x){
            vm.msg="恭喜你,猜对了!,一共猜了:"+z+"次!";
        }else if($("input:eq(0)").val()<x){
            vm.msg="猜小了!";
        }else {
            vm.msg="猜大了!";
        }
    })

</script>
</html>